<template>
    <div class="header-warp">
        <div class="title">{{moudelName}}</div>
        <div class="right-content">
            你好,{{name}} 
            <img @click="logout" src="../assets/logout.png"/>
        </div>
    </div>
</template>

<script setup>
import { useRoute } from 'vue-router';
import { computed } from 'vue';

const route = useRoute();
const moudelName = computed(() => {
  return route.meta.name;
});

const username = localStorage.getItem('username')
const name = localStorage.getItem('name')

import { useRouter } from "vue-router";
const router = useRouter();
const logout = () => {
  localStorage.removeItem("userId");
  localStorage.removeItem("username");
  localStorage.removeItem("name");
  router.push("/");
};
</script>

<style scoped lang="less">
    .header-warp{
        border-bottom: 1px solid #c1c1c1;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;

        .right-content{
             display: flex;
        align-items: center;
            img{
                cursor: pointer;
                margin-left: 10px;
                height: 1rem;
                width: 1rem;
            }
        }
    }
</style>